docs: get the pixbuf options from the existing instead of hardcoding.
authorWilliam Jon McCann <william.jon.mccann@gmail.com>
Thu, 13 Feb 2014 17:08:03 +0000 (12:08 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 14 Feb 2014 01:47:25 +0000 (20:47 -0500)
docs/tools/shooter.c

index 15e1daa224395fc867e0665d581370d740762812..854331821152e56fd78f80a4ab30161b023a146a 100644 (file)
@@ -54,8 +54,12 @@ static GdkPixbuf *
 add_border_to_shot (GdkPixbuf *pixbuf)
 {
   GdkPixbuf *retval;
+  GdkColorspace colorspace;
+  int bits;
 
-  retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+  colorspace = gdk_pixbuf_get_colorspace (pixbuf);
+  bits = gdk_pixbuf_get_bits_per_sample (pixbuf);
+  retval = gdk_pixbuf_new (colorspace, TRUE, bits,
                           gdk_pixbuf_get_width (pixbuf) + 2,
                           gdk_pixbuf_get_height (pixbuf) + 2);
 
@@ -78,8 +82,12 @@ remove_shaped_area (GdkPixbuf *pixbuf,
   XRectangle *rectangles;
   int rectangle_count, rectangle_order;
   int i;
+  GdkColorspace colorspace;
+  int bits;
 
-  retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+  colorspace = gdk_pixbuf_get_colorspace (pixbuf);
+  bits = gdk_pixbuf_get_bits_per_sample (pixbuf);
+  retval = gdk_pixbuf_new (colorspace, TRUE, bits,
                           gdk_pixbuf_get_width (pixbuf),
                           gdk_pixbuf_get_height (pixbuf));